import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:study_online/pages/testPage/TestModel.dart';

import '../../main.dart';

class TestViewModel extends ChangeNotifier {
  void insert(int paId, String stuId, double acc, double grade, int probleNum,
      int trueNum, List<int> ansList, String title,int minute,int second) async {
    Response result = await insertGrade(paId, stuId, acc, grade); //连接model
    print("###" + result.toString());
    if (result.data["code"] == 1) {
      EasyLoading.showSuccess(result.data["msg"]);
      Navigator.of(navigatorKey.currentContext).pushNamed('testReport',arguments: [trueNum,ansList,title,minute,second]);
    } else
      EasyLoading.showError(result.data["msg"]);
  }
}
